package com.yuneec.droneservice.command;

import com.MAVLink.yuneec.msg_mav_rc_cmd_ack;
import com.yuneec.droneservice.request.IResponse;

/**
 * 通过2.4G透传Payload给飞机
 * Created by gjw on 2017/3/27.
 */

public class SendPayload extends BaseCommand {
    private final byte[] data;

    public SendPayload(byte[] data) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_SEND_PAYLOAD);
        this.data = data;
    }

    @Override
    protected short[] body() {
        short[] body = new short[data.length];
        byteArrayToUIntArray(body, 0, data, 0);
        return body;
    }

    @Override
    public IResponse toResponse(msg_mav_rc_cmd_ack ack) {
        int code = ack.code;
        return new IResponse(ids(), code);
    }

}
